﻿<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ZLCMS.Web.Wap.Shop.Default" %>

<%@ Import Namespace ="ZLCMS.Business.Util" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0 ,user-scalable=no">
<link href="/Wap/lib/jquerymobile/css/jquery.mobile-1.4.0.min.css" rel="stylesheet" type="text/css" />
<script src="/Wap/lib/jquery/jquery-1.10.2.min.js"></script>
<script src="/Wap/lib/jquery/jquery.cookie.js"></script>
<script src="/Wap/lib/jquerymobile/jquery.mobile-1.4.0.min.js"></script>
<link rel="stylesheet" href="/Wap/shop/themes/myjqm.css" />
<link rel="stylesheet" href="/Wap/lib/jquerymobile/css/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="/Wap/lib/jquerymobile/css/jquery.mobile.structure-1.4.0.css" />   
<link href="css/dayhot.css" rel="stylesheet" type="text/css" />
<link href="/Wap/shop/css/my.css" rel="stylesheet" type="text/css"/>
    <title>V.生活商城，正品保证，全省包邮</title>
<style type="text/css">
.xiaovstyle3 {margin:0;}
.xiaovstyle3 ul li{box-shadow: 1px 1px #eeeeee; padding: 5px 0;}
.xiaovstyle3 ul li p.xvdesc{color:#f9384d; margin-bottom : 0; font-weight: normal; height: 16px;}
.xiaovstyle3 ul li p.xvdesc font{color:#f9384d; margin:0 2px;}
.xiaovstyle3 ul li p.xvtitle{margin-bottom: 0; font-size: 14px;padding: 0 5px; overflow: hidden; font-weight: normal;   height:22px;}
.xiaovstyle3 ul li:nth-of-type(3) ~ li {margin-top: 0;}
.xiaovstyle3 ul{padding:0; border-top: 1px solid #eeeeee;}
.xiaovstyle3 ul li > a > img{width: 75%;}
</style>
</head>
<body>
<div data-role="page" data-theme="b" style="background:#c80509" id="currentorders">
   <header data-role="header" data-position="fixed" class="nav-hed">
        <nav data-role="navbar">
            <div id="overflow">
                <div class="container">
                    <img src="images/pmlist.png" class="pmlist"/>
                    <a href="#" class="active"><span>首页</span></a>
                    <a href="list.html#kind=snsg" data-ajax="false"><span>时令果蔬</span></a>
                    <a href="list.html#kind=spxx" data-ajax="false"><span>食品新鲜</span></a>
                    <a href="list.html#kind=lszb" data-ajax="false"><span>零食滋补</span></a>
                    <a href="list.html#kind=lymm" data-ajax="false"><span>粮油米面</span></a>
                    <a href="list.html#kind=mcjs" data-ajax="false"><span>茗茶酒水</span></a>
                    <a href="list.html#kind=jydq" data-ajax="false"><span>家电家居</span></a>
                </div>
            </div>
        </nav>
    </header>
    <div data-role="content">
        <a href="#"><img src="images/content1.jpg" style="display:block;width:100%;"></a>
        <div style="position:relative">
            <img src="images/content2.jpg" style="display:block;width:100%;">
            <a href="http://dvms.weixinmvp.com/Wap/Lottory/default.aspx" style="position:absolute;left:0; top:0;width: 50%;height:100%"></a>
            <a href="http://dvms.weixinmvp.com/wap/seckill/default.aspx" style="position:absolute;left:50%; top:0;width: 50%;height:100%"></a>
        </div>
        <div>
            <a href="/Wap/Shop/xyqd.aspx" data-ajax="false">
            <img src="images/content3.gif" style="display:block; width:100%; margin-bottom: 10px;">
            </a>
        </div>
    <div style="background:#F9F8F8">
        <div class="xiaovstyle3">
            <h5 style="margin: 5px 0px; text-align: center; font-weight: normal;"><span style="color:#f9384d; font-size:16px;margin-right:2px;">小V</span>爆款</h5>
            <ul class="xiaovtuijian" id="tj_1">
            </ul>
        </div>

        <div class="newproductlbox" style="border:none; margin: 10px auto 0;display:none;">
        <div class="xiaovstyle3" >
        <h5 style="margin: 10px 0px; text-align: center; font-weight: normal;"><span style="color:#f9384d; font-size:16px;margin-right:2px;">小V</span>新品</h5>
            <ul class="newproductlist">
            </ul>
        </div>
            <div style="display:none">
                <button id="Button1" data-icon="refresh" style="width: 95%; margin-left: auto; margin-right: auto;">显示更多</button>
            </div>
        </div>

        <div class="" style="border:none; margin: 10px auto 0;">
        <div class="xiaovstyle3">
        <h5 style="margin: 10px 0px; text-align: center; font-weight: normal;"><span style="color:#f9384d; font-size:16px;margin-right:2px;">小V</span>推荐</h5>
            <ul class="hotproductlist">
            </ul>
        </div>
            <div style="display:none">
                <button id="btnMore" data-icon="refresh" style="width: 95%; margin-left: auto; margin-right: auto;">显示更多</button>
            </div>
        </div>
     </div>
    </div>
 <div data-role="footer" data-position="fixed" data-tap-toggle="false">
        <ul class="footer shop">
            <li><a href="/Wap/Shop/Default.aspx" data-ajax="false" class="active"><div></div><p>首页</p></a></li>
            <li><a href="/Wap/Shop/Category.aspx" data-ajax="false"><div></div><p>分类</p></a></li>
            <li><a href="http://dvms.weixinmvp.com/Wap/Seckill/default.aspx" data-ajax="false"><div></div><p>秒杀</p></a></li>
            <li><a href="/Wap/ShoppingCart/" data-ajax="false"><div></div><p>购物车</p></a></li>
            <li><a href="/wap/shop/MemberDefault.aspx" data-ajax="false"><div></div><p>我</p></a></li>
        </ul>

    </div>

</div>
    
    <script type="text/javascript">
        var shareUrl = window.location.href; //分享链接,当前页面
        var shareTitle = window.document.title; //分享标题
        var shareLogo = '<%=ServerUtil.GetRootURI() %>/wap/shop/images/shop_logo.jpg'; //分享图标
        var shareDesc = '<%= ParamKit.GetValue("SystemConfig", "Desciption", "&nbsp") %>'; //分享描述
    </script>


      
    <%=ZLCMS.Business.WeixinService.JSSDKUtil.GetConfigScript()%>
    <script type="text/javascript" >
        var isWifi = false;
        wx.ready(function () {
            wx.onMenuShareTimeline({
                title: shareTitle, // 分享标题
                link: shareUrl, // 分享链接
                imgUrl: shareLogo, // 分享图标
                success: function () {
                    // 用户确认分享后执行的回调函数
                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数
                }
            });
            wx.onMenuShareAppMessage({
                title: shareTitle, // 分享标题
                desc: shareDesc, // 分享描述
                link: shareUrl, // 分享链接
                imgUrl: shareLogo, // 分享图标
                success: function () {
                    // 用户确认分享后执行的回调函数
                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数
                }
            });
            wx.getNetworkType({
                success: function (res) {
                    var networkType = res.networkType; // 返回网络类型2g，3g，4g，wifi

                    if (networkType == "wifi") {
                        isWifi = true;
                    }

                    $(document).triggerHandler('getNetworkType', { type: networkType });
                    //alert(networkType);

                }
            });

        });
    </script>
<!--#include file="/Code/StatCode/baidustat.inc" -->



<script src="/Wap/lib/command/Command.js" type="text/javascript"></script>
<script src="/Wap/lib/jquery/jquery.json-2.2.min.js" type="text/javascript"></script>
<script src="/Wap/lib/common/querymobile.alertMsg.js?v=11"></script>
<script src="/wap/lib/common/listviewHandler.js" type="text/javascript"></script>
<script src="/Wap/lib/jquery_lazyload/jquery.lazyload.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/wap/lib/iscroll-5/iscroll.js"></script>
<script src="/wap/lib/common/loaderHandler.js" type="text/javascript"></script>
<script src="/Wap/lib/jquery_lazyload/jquery.lazyload.min.js" type="text/javascript"></script>
<script>
    hashCode = function (str) {
        var hash = 0;
        if (str.length == 0) return hash;
        for (i = 0; i < str.length; i++) {
            char = str.charCodeAt(i);
            hash = ((hash << 5) - hash) + char;
            hash = hash & hash; // Convert to 32bit integer
        }
        return hash;
    }

    var stateKey = "P" + hashCode(window.location.href);

    $(function () {
        $(".container a").click(function () {
            $(this).removeClass('').addClass('active').siblings().removeClass('active');
        });

        function initializePage() {
            var handler = $('.xiaovtuijian').loaderHandler();
            handler.initialize({
                command: 'Pub.LoadAdProduct',
                parameter: { PositionCode: 'HOME_XV_TJ', PageSize: 12 },
                afterHandleResult: function (result, totalCount, container) {
                    var itemxiaovstyle4 = '<li>' +
                 '<p class="xvtitle">{Title}</p>' +
                    '<p class="xvdesc">{Description}</p>' +
                    '<a data-ajax="false" href="{Url}">' +
                    '<img class="pimgc" data-original="{PhotoUrl}" src="images/loading.gif"></a>' +
                    '<div ><i>已售<em>{SellCount}</em></i></div>' +
                '</li>';
                    $(result.List).each(function () {
                        this.PhotoUrl = firstFilePath(this.PhotoUrl);
                        $('.xiaovtuijian').append(itemxiaovstyle4.format(this));
                        //图片延迟加载
                        $('img.pimgc').lazyload({
                            event: 'scrollstop'
                        });
                    });
                }
            });
            handler.load();
            queryNewProduct();
        }

        function queryNewProduct() {
            var handler = $('.newproductlist').loaderHandler();
            handler.initialize({
                command: 'Pub.LoadAdProduct',
                parameter: { PositionCode: 'HOME_XV_TJ', PageSize: 12 },
                afterHandleResult: function (result, totalCount, container) {
                //大于0显示
                    if (totalCount > 0) {
                        $('.newproductlbox').show();
                    }
                    var itemxiaovstyle4 = '<li>' +
                 '<p class="xvtitle">{Title}</p>' +
                    '<p class="xvdesc">{Description}</p>' +
                    '<a data-ajax="false" href="{Url}">' +
                    '<img class="pimgc" data-original="{PhotoUrl}" src="images/loading.gif"></a>' +
                    '<div style="display:none"><i>已售<em>{SellCount}</em></i></div>' +
                '</li>';
                    $(result.List).each(function () {
                        this.PhotoUrl = firstFilePath(this.PhotoUrl);
                        $('.newproductlist').append(itemxiaovstyle4.format(this));
                        //图片延迟加载
                        $('img.pimgc').lazyload({
                            event: 'scrollstop'
                        });
                    });
                   
                }
            });
            handler.load();
            queryData();
        }

        function queryData() {
            var handler = $('.hotproductlist').listviewHandler();

            var itemTemp = '<li>' +
                 '<p class="xvtitle">{Title}</p>' +
                    '<p class="xvdesc" style="color:#999">{Description}</p>' +
                    '<a data-ajax="false" href="{Url}">' +
                    '<img class="pimgc" data-original="{PhotoUrl}" src="images/loading.gif"></a>' +
                '</li>';

            var pageSize = 9;
            if ($.cookie(stateKey + 'size') > 9) {
                pageSize = $.cookie(stateKey + 'size');
            }
            handler.initialize({
                loaderBtn: $('#btnMore'), //加载数据按钮（点击加载下一页）
                emptyHtml: '无记录', //无记录时显示此html
                itemTemplate: itemTemp, //项模板
                pageIndex: 1, //页码（从1起算）
                pageSize: pageSize, //页大小
                totalCount: 999, //总记录数
                itemHandler: function (data, itemTemplate, container) {//数据各项处理
                    data.PhotoUrl = firstFilePath(data.PhotoUrl);
                    return itemTemplate.format(data);
                },
                afterHandleResult: function (result, totalCount, container) {
                    //图片延迟加载
                    $('img.pimgc').lazyload({
                        event: 'scrollstop'
                    });
                    if (initialze) {
                        if ($.cookie(stateKey)) {
                            var position = $.cookie(stateKey);
                            $("html,body").animate({ scrollTop: position }, 200, function () { initialze = false; });
                        }
                        else {
                            initialze = false;
                        }
                    }
                },
                command: 'Pub.LoadAdProduct',
                parameter: { PositionCode: 'HOME_NH' }
            });
            handler.nextPage();
        }

        var initialze = false;
        $(function () {
            initialze = true;
            initializePage();
            $(window).scroll(function () {

                if (!initialze) {
                    var pageSize = $('.hotproductlist li').length;
                    $.cookie(stateKey + 'size', pageSize, { path: '/' });

                    var top = $(document).scrollTop();
                    $.cookie(stateKey, top, { path: '/' });
                    //return $.cookie(str);

                    //当内容滚动到底部时加载新的内容
                    if ($(this).scrollTop() + $(window).height() + 20 >= $(document).height() && $(this).scrollTop() > 20) {
                        //当前要加载的页码
                        $('#btnMore').click();
                    }

                }
            });
        });

    });


</script>

</body>
</html>

